<#include "/common/pagerForm.html">
<form rel="pagerForm" method="post" action="" onsubmit="return navTabSearch(this)">
    <div class="pageHeader">
        <div class="searchBar">
            <ul class="searchContent">
                <li><label id="ruleCode" style="width: 90px;"><@label key="ruleCode.C,colon">编码规则编号：</@label></label> <input type="text" name="ruleCode" value="${condition.ruleCode!''}" /></li>
                <li><label id="ruleText" style="width: 90px;"><@label key="ruleText.C,colon">编码规则描述：</@label></label> <input type="text" name="ruleText" value="${condition.ruleText!''}" /></li>
                <li>
                    <div class="buttonActive">
                        <div class="buttonContent">
                            <button id="st" type="submit"><@label key="query.B">查询</@label></button>
                        </div>
                    </div>
                </li>

            </ul>
        </div>
    </div>
</form>

<div class="pageContent">

    <div class="panelBar">
        <ul class="toolBar">
            <@buttonRight menuCode="numberRule_add" labelKey="add.B" defalutName="新增">
            <li><a class="add" target="dialog" mask="true" width="640" height="220" href="${rc.getContextPath()}/manage/numberRule/addNumberRule?navTabId=${navTabId!''}" rel="addUser" title="<@label key="addNumber.C">新增编码规则</@label>"><span><@label key="add.B">新增</@label></span>
            </a>
            </li>
            </@buttonRight>
            <@buttonRight menuCode="numberRule_edit" labelKey="edit.B" defalutName="编辑">
            <li><a class="edit" target="dialog" mask="true" width="640" height="330" href="${rc.getContextPath()}/manage/numberRule/editNumberRule?id={number_code}&navTabId=${navTabId!''}" rel="modifyUser" title="<@label key="editNumber.C">编辑编码规则</@label>"><span><@label key="edit.B">编辑</@label></span>
            </a>
            </li>
            </@buttonRight>
             <@buttonRight menuCode="numberRule_view" labelKey="view.B" defalutName="详情">
            <li><a class="icon" target="dialog" mask="true" width="640" height="265" href="${rc.getContextPath()}/manage/numberRule/viewNumberRule?id={number_code}&navTabId=${navTabId!''}" rel="viewUser" title="<@label key="viewNumber.C">编码规则详情</@label>"><span><@label key="view.B">详情</@label></span>
            </a>
            </li>
            </@buttonRight>
             <@buttonRight menuCode="numberRule_del" labelKey="delete.B" defalutName="删除">
            <li><a class="delete" target="ajaxTodo" href="${rc.getContextPath()}/manage/numberRule/deleteNumberRule?id={number_code}&navTabId=${navTabId!''}" title="<@label key="delNumber.M">确认要删除选中的编码规则吗？</@label>"><span><@label key="delete.B">删除</@label></span>
            </a>
            </li>
            </@buttonRight>
            
             <@buttonRight menuCode="numberRule_test" labelKey="testNumber.B" defalutName="编码规则测试">
            <li><a class="icon"  href="javascript:void(0);" onclick="test()"><span><@label key="testNumber.B">编码规则测试</@label></span>
            </a>
            </li>
            </@buttonRight>
        </ul>
    </div>
    <table class="table" width="100%" layoutH="132">
        <thead>
            <tr>
                <th width="100" orderField="ruleCode"<#if (page.orderField?? && page.orderField == 'ruleCode')>class="${page.orderDirection!''}"</#if>><@label key="ruleCode.C">编码规则编号</@label></th>
                <th width="100" orderField="ruleText"<#if (page.orderField?? && page.orderField == 'ruleText')>class="${page.orderDirection!''}"</#if>><@label key="ruleText.C">编码规则描述</@label></th>
                <th width="100" orderField="preFix"<#if (page.orderField?? && page.orderField == 'preFix')>class="${page.orderDirection!''}"</#if>><@label key="preFix.C">编码前缀</@label></th>
                <th width="100" orderField="enableDateFlag"<#if (page.orderField?? && page.orderField == 'enableDateFlag')>class="${page.orderDirection!''}"</#if>><@label key="enableDateFlag.C">是否启用日期</@label></th>
                <th width="100" orderField="currentOrdinal"<#if (page.orderField?? && page.orderField == 'currentOrdinal')>class="${page.orderDirection!''}"</#if>><@label key="currentOrdinal.C">当前编号</@label></th>
                <th width="100" orderField="ordinalLength"<#if (page.orderField?? && page.orderField == 'ordinalLength')>class="${page.orderDirection!''}"</#if>><@label key="ordinalLength.C">编号长度</@label></th>
            </tr>
        </thead>
        <tbody>
            <#if page??><#if (page.data?size>0)> <#list page.data as number>
            <tr target="number_code" rel="${number.ruleCode!''}">
                <td>${number.ruleCode!''}</td>
                <td>${number.ruleText!''}</td>
                <td>${number.preFix!''}</td>
                <td><#if number.enableDateFlag == 0><@label key="no.C">否</@label><#else><@label key="yes.C">是</@label></#if></td>
                <td>${number.currentOrdinal!''}</td>
                <td>${number.ordinalLength!''}</td>
            </tr>
            </#list> <#else>
            <tr target="number_code">
                <td colspan="6" class="noData">======<@label key="noListData.C">列表无数据</@label>=====</font>
                </td>
            </tr>
            </#if> <#else>
            <tr target="number_code">
                <td colspan="6" class="noData">======<@label key="noListData.C">列表无数据</@label>=====</font>
                </td>
            </tr>
            </#if>
        </tbody>
    </table>
    <#include "/common/panelBar.html">
</div>

  <script type="text/javascript">
  function test()
  {
      if($("#number_code").length==0)
          {
            alertMsg.error('<@label key="select_one.D">请选择一条记录</@label>')
             return;
          }
      var code=$("#number_code").val();
      $.ajax({
          type:'POST',
          url: "${rc.getContextPath()}/manage/numberRule/testRule",
          data: {"id":code},
          dataType: "text",
          timeout: 1000 * 10,  //AJAX请求超时时间为10秒  
          success: function (data, textStatus) {
              alertMsg.correct('<@label key="currentOrdinal.C,colon">当前编号：</@label>'+data);
              document.getElementById("st").click(); 
          }
      });
  }
  </script>